using Reflector.CodeModel;
using System;
using System.Collections.Generic;
using System.Text;

namespace FileGenerator.AddIn
{
	public class LanguageWriterConfiguration : ILanguageWriterConfiguration
	{
        internal static  bool[] vars = new bool[6] { true, true, true, true, true, true };
		public LanguageWriterConfiguration()
		{
            string s = FileGeneratorPackage.GetConfigString("AssemblyBrowser","Visibility");
            VisibilityConfiguration vis = new VisibilityConfiguration();

            if (s == "PublicOnly")
            {
                vars[0] = vars[2] = vars[3] = vars[4] = false;
                vars[1] = vars[5] = true;
            }
            else
            {
                vars[0] = vars[1] = vars[2] = vars[3] = vars[4] = vars[5] = false;
            }

            this.Visibility = vis;
		}

		public IVisibilityConfiguration Visibility
		{
			get;
			private set;
		}

		public string this[string name]
		{
			get
			{
				switch(name)
				{
					case "ShowDocumentation":
					case "ShowCustomAttributes":
					case "ShowNamespaceImports":
					case "ShowNamespaceBody":
					case "ShowTypeDeclarationBody":
					case "ShowMethodDeclarationBody":
						return "true";
				}

				return "false";
			}
		}

		private class VisibilityConfiguration : IVisibilityConfiguration
		{
           
			public bool Assembly
			{
                get { return vars[0]; } 
			}

			public bool Family
			{
                get { return vars[1]; }
			}

			public bool FamilyAndAssembly
			{
                get { return vars[2]; }
			}

			public bool FamilyOrAssembly
			{
                get { return vars[3]; }
			}

			public bool Private
			{
                get { return vars[4]; }
			}

			public bool Public
			{
                get { return vars[5]; }
			}
		}
	}
}
